package com.liangjie.bbs;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

public class Article {
	private int id;
	private int pId;
	private int rootID;
	private String title;
	private Date pDate;
	private boolean isLeaf;
	private int level;
	private String cont;

	public String getCont() {
		return cont;
	}

	public void setCont(String cont) {
		this.cont = cont;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getpId() {
		return pId;
	}

	public void setpId(int pId) {
		this.pId = pId;
	}

	public int getRootID() {
		return rootID;
	}

	public void setRootID(int rootID) {
		this.rootID = rootID;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public Date getpDate() {
		return pDate;
	}

	public void setpDate(Date pDate) {
		this.pDate = pDate;
	}

	public boolean isLeaf() {
		return isLeaf;
	}

	public void setLeaf(boolean isLeaf) {
		this.isLeaf = isLeaf;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public void initFromJsp(ResultSet rs) {
		try {
			setId(rs.getInt("id"));
			setpId(rs.getInt("pid"));
			setRootID(rs.getInt("rootid"));
			setTitle(rs.getString("title"));
			setCont(rs.getString("cont"));
			setpDate(rs.getTimestamp("pdata"));
			setLeaf(rs.getInt("isleaf") == 0);
			setLevel(0);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

}
